package org.jeecg.modules.permission.api;

import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.ServiceNameConstants;
import org.jeecg.modules.permission.fallback.PermissionFallback;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Component
@FeignClient(contextId = "SysPermissionApi", value = ServiceNameConstants.SERVICE_SYSTEM, path = ServiceNameConstants.PATH_SYS_PERMISSION, fallback = PermissionFallback.class)
@ConditionalOnMissingClass("org.jeecg.modules.system.controller.SysPermissionController")
public interface PermissionApi {


    @RequestMapping(value = "/queryRolePermission", method = RequestMethod.GET)
    @ApiOperation("查询角色权限")
    public Result<List<String>> queryRolePermission(@RequestParam(name = "roleId", required = true) String roleId);


    @GetMapping(value = "/saveRolePermissionList")
    @ApiOperation("保存角色权限")
    public Result<String> saveAndUpdateRolePermission(@RequestParam(name = "roleId", required = true) String roleId,
                                                      @RequestParam String permissionIds);


}
